--- a/ofstd/libsrc/oftime.cc
+++ b/ofstd/libsrc/oftime.cc
-@@ -491,6 +491,10 @@
+@@ -47,6 +47,7 @@
+ #include "dcmtk/ofstd/oftime.h"
+ #include "dcmtk/ofstd/ofstd.h"
+
++#include <cmath>
+
+ /*------------------*
+ * implementation *
+@@ -99,13 +100,16 @@
+
+ OFBool OFTime::operator==(const OFTime &timeVal) const
+ {
+- return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) == timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/));
++ // Dicom supports at most 6 decimal digits, to compare cut off to eliminate numerical errors.
++ double me = rint(getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000);
++ double other = rint(timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000);
++ return me == other;
+ }
+
+
+ OFBool OFTime::operator!=(const OFTime &timeVal) const
+ {
+- return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) != timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/));
++ return ! (*this == timeVal);
+ }
+
+
+@@ -491,6 +495,7 @@
{
/* compute number of seconds since 00:00:00 */
double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second;
+
-+ /* Dicom supports only six decimal digits, but floating point operations might introduce errors */
-+ result = round(result * 1000000.0) / 1000000.0;
-+
/* normalize the result to the range [0.0,86400.0[ */
if (normalize)
result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400);